home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1992-09-29 | 2.1 KB | 56 lines |
- '*******************************************************
- '* *
- '* AMOS Professional Procedure Library *
- '* *
- '* Procedure: Spline Drawing *
- '* *
- '* Author: Hedwig Janssens *
- '* *
- '*******************************************************
-
- '------- Initialize screen,palette and coordinate stack -------
- Screen Open 0,320,256,32,LORES
- Flash Off : Curs Off : Hide
- For R=0 To 31 : Colour R,256*(R/2)+16*(R/3) : Next R : Colour 31,$FD0
- Cls 0
- Dim X1(31),Y1(31),X2(31),Y2(31),X3(31),Y3(31)
- P=1
- '
- '------- Randomize starting positions -------------------------
- X1=Rnd(318) : Y1=Rnd(254) : X1D=-4 : Y1D=6
- X2=Rnd(318) : Y2=Rnd(254) : X2D=4 : Y2D=4
- X3=Rnd(318) : Y3=Rnd(254) : X3D=4 : Y3D=-6
- '
- Do
- '-------- Check screen borders and bounce back ----------------
- X1=X1+X1D : If X1>318 or X1<1 Then X1D=-X1D
- Y1=Y1+Y1D : If Y1>253 or Y1<1 Then Y1D=-Y1D
- X2=X2+X2D : If X2>318 or X2<1 Then X2D=-X2D
- Y2=Y2+Y2D : If Y2>253 or Y2<1 Then Y2D=-Y2D
- X3=X3+X3D : If X3>318 or X3<1 Then X3D=-X3D
- Y3=Y3+Y3D : If Y3>253 or Y3<1 Then Y3D=-Y3D
- Ink 0 : _SPLINE[X1(P),Y1(P),X2(P),Y2(P),X3(P),Y3(P),8]
- Shift Up 320,1,31,1
- Ink P : _SPLINE[X1,Y1,X2,Y2,X3,Y3,8]
- '------ Put coordinates in stack for making a trail ----------
- X1(P)=X1 : Y1(P)=Y1 : X2(P)=X2 : Y2(P)=Y2 : X3(P)=X3 : Y3(P)=Y3
- Add P,1,1 To 31
- Loop
- '
- Procedure _SPLINE[XB,YB,XE,YE,XC,YC,S]
- '
- ' Inputs: XB,YB Begin coordinate spline
- ' XE,YE End coordinate spline
- ' XC,YC Control coordinate spline
- ' S Number of Subdivisions for building curve
- ' Outputs: Plots to current screen in current color
- '
- FL=0
- For ST=0 To S
- XS1=XB-((XB-XC)*ST)/S : YS1=YB-((YB-YC)*ST)/S
- XS2=XC-((XC-XE)*ST)/S : YS2=YC-((YC-YE)*ST)/S
- XS=XS1-((XS1-XS2)*ST)/S : YS=YS1-((YS1-YS2)*ST)/S
- If FL=0 Then FL=1 Else Draw XO,YO To XS,YS
- XO=XS : YO=YS
- Next ST
- End Proc